Repository navigation
Fix the Memory screen loading forever in offline review - #10115
Open
maheshrijal wants to merge 2 commits into
Open
maheshrijal wants to merge 2 commits into
maheshrijal wants to merge 2 commits into
Conversation
When the app disconnected, MemoryController.prepareOfflineScreenData saved its live DiffPaneController, ProfilePaneController, ChartData, and TracePaneController objects as the offline data. DevTools then disposed the controller, and that also disposed those objects. The offline MemoryController reused the disposed objects. In debug builds, a disposed ValueNotifier throws when it is used, so `initialized` never completed and the screen kept showing a spinner. prepareOfflineScreenData now converts the data to maps and lists with toJson. The offline MemoryController builds new controllers from them, the same way it does for an imported file. Heap snapshot graphs are kept as references, so the data is not copied. Fixes flutter#10103
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
maheshrijal
added a commit
to maheshrijal/devtools
that referenced
this pull request
Dec 3, 2026
maheshrijal
added a commit
to maheshrijal/devtools
that referenced
this pull request
Dec 3, 2026
maheshrijal
marked this pull request as ready for review
December 3, 2026 06:10
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #10103
When the app disconnects, DevTools saves each screen's data so you can click Review recent data (offline). The Memory screen saved its live
DiffPaneController,ProfilePaneController,ChartData, andTracePaneControllerobjects. DevTools then disposed the connectedMemoryController, which also disposed those objects. The offlineMemoryControllerreused them, threw when it used a disposedValueNotifier, and never completedinitialized.prepareOfflineScreenDatanow converts the data to maps and lists withtoJson. The offlineMemoryControllerbuilds new controllers from them, the same way it does for an imported file. Heap snapshot graphs are kept as references, so a large snapshot is not copied.This change has two side effects:
Tests
I added two tests. Both fail on master and pass with this change.
memory_screen_test.dartsaves the data, disposes the connected controller as a disconnect does, and loads the offline Memory screen.memory_controller_test.dartchecks that the offline data shares no disposable objects with the connected controller, and that it keeps the same heap graph.I also ran DevTools locally in debug mode, connected it to a Dart CLI app, took a heap snapshot, stopped the app, and clicked Review recent data (offline). On master, the Memory screen showed a spinner that never stopped, and the console logged "Error loading offline data for memory". With this change, the offline Memory screen shows the chart history, the Profile Memory table, and the heap snapshot in Diff Snapshots.
Before (master): the Memory screen keeps loading after clicking Review recent data (offline).
After: the offline Memory screen shows the recorded data.
Pre-launch Checklist
General checklist
///).Issues checklist
contributions-welcomeorgood-first-issuelabel.contributions-welcomeorgood-first-issuelabel. I understand this means my PR might take longer to be reviewed.Tests checklist
AI-tooling checklist
Feature-change checklist
release-notes-not-requiredlabel or left a comment requesting the label be added.packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md.If you need help, consider asking for help on Discord.